
const { ccclass, property } = cc._decorator;

import MeiMao from "./MeiMao";
import KouHong from "./KouHong";
@ccclass
export default class StepSeven extends cc.Component {
    //触摸区域
    @property(cc.Node)
    bg: cc.Node = null;
    //第七步
    //眉毛
    @property(MeiMao)
    MeiMao: MeiMao = null;
    //口红
    @property(KouHong)
    KouHong: KouHong = null;

    _point = 1;
    onLoad() {
        this.bg.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
        this.bg.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
        this.bg.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
    };

    onTouchStart(event) {
        switch (this._point) {
            case 1:
                this.MeiMao._touchStart(event);
                break;
            case 2:
                this.KouHong._touchStart(event);
                break;
        }
    };

    onTouchMove(event) {
        switch (this._point) {
            case 1:
                this.MeiMao._touchMove(event);
                break;
            case 2:
                this.KouHong._touchMove(event);
                break;
        }
    };

    onTouchEnd(event) {
        switch (this._point) {
            case 1:
                this.MeiMao._touchEnd(event);
                break;
            case 2:
                this.KouHong._touchEnd(event);
                break;
        }
    };

    //更新步骤
    updatePoint(point: number) {
        this._point = point;
        this.MeiMao.node.active = point == 1;
        this.KouHong.node.active = point == 2;
        switch (point) {
            case 1:
                this.MeiMao.initData();
                break;
            case 2:
                this.KouHong.initData();
                break;
        }
    };


}
